<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<pre>
                                    Work1
from time import sleep


class Person(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def speak(self):
        print("name={} age={}".format(self.name, self.age))


class Student(Person):
    def __init__(self, name, age, school, my_id):
        Person.__init__(self,name, age)
        self.school = school
        self.my_id = my_id

    def speak(self):
        print("name={} age={} school={} my_id={}".format(self.name, self.age, self.school, self.my_id))

    def run(self, v, times):
        print("跑了", v * times, "米")


class CollegeStudent(Student):
    def __init__(self, name, age, school, my_id, language):
        Student.__init__(self,name, age, school, my_id)
        self.language = language

    def speak(self):
        print("name={} age={} school={} my_id={} language={}".format(self.name, self.age, self.school, self.my_id,
                                                                     self.language))

    def coding(self):
        i = 1
        while i <= 10:
            if i == 1:
                print("I am coding", end="")
            print(".", end="")
            sleep(1)
            i += 1


c1 = CollegeStudent("jack", 18, "哈佛", 123, "ENG")
c1.speak()
c1.run(5,10)
c1.coding()





                                    Work2

from functools import wraps


class AuthClass(object):
    name = "python"
    pwd = 123

    def __init__(self, name, pwd):
        self.name = name
        self.pwd = pwd

    def auth(self):
        if self.name == "python" and self.pwd == 123:
            return True
        else:
            return False


user = AuthClass("python", 123)


def fun(login):
    @wraps(login)
    def inner(user):
        if user.auth():
            login(user)
        else:
            print("登录失败")
    return inner


@fun
def login(user):
    print("成功登录")


login(user)


                                    Work3

import datetime
from functools import wraps


def log_it(fuc):
    @wraps(fuc)
    def with_logging(txt_location):
        print(fuc.__name__, "was called at ", datetime.datetime.now())
        fuc(txt_location)

    return with_logging


@log_it
def fun(txt_loaction):
    file_handle = open(txt_loaction, mode='w')
    name = fun.__name__
    file_handle.write(name+" "+str(datetime.datetime.now()))
    file_handle.close()


fun(r"C:\Users\Lenovo\Desktop\data.txt")
</pre>
</body>
</html>